package com.kid.keep.controller;

import com.kid.keep.dto.AddChildCheckItemResultDTO;
import com.kid.keep.dto.ChildCheckItemResultDetailDTO;
import com.kid.keep.request.AddCheckItemResultRequest;
import com.kid.keep.vo.*;
import com.honeybee.cloud.framework.common.response.ResponseEntity;
import com.honeybee.cloud.framework.validation.number.Number;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Description 检测报告
 * @Author JOHN
 * @Create 2020-01-06
 * @Since 1.0.0
 */
@RequestMapping("kid-keep")
public interface ICheckReportController {

    /**
     * 获取检测报告详情
     *
     * @param reportId
     * @return
     */
    @RequestMapping(name = "获取检测报告详情", value = "/v1/reports/{reportId}", method = RequestMethod.GET)
    ResponseEntity<CheckItemReportDetailVO> getCheckReport(@PathVariable("reportId") Long reportId);

    /**
     * 重新检测
     *
     * @param reportId
     * @return
     */
    @RequestMapping(name = "重新检测", value = "/v1/reports/{reportId}", method = RequestMethod.PUT)
    ResponseEntity<CheckItemReportDetailVO> startCheckReportAgain(@PathVariable("reportId") Long reportId);
    /**
     * 获取检测报告要测评的项目
     *
     * @param reportId
     * @return
     */
    @RequestMapping(name = "获取检测报告要测评的项目", value = "/v1/reports/{reportId}/items", method = RequestMethod.GET)
    ResponseEntity<List<ChildCheckItemVO>> getCheckItems(@PathVariable("reportId") Long reportId);
    /**
     * 获取检测项目详情
     *
     * @param reportId
     * @param itemId
     * @return
     */
    @RequestMapping(name = "获取检测项目详情", value = "/v1/reports/{reportId}/items/{itemId}", method = RequestMethod.GET)
    ResponseEntity<ChildCheckItemVO> getCheckItemInfo(@PathVariable("reportId") Long reportId,@PathVariable("itemId")Long itemId);
    /**
     * 获取报告总数
     *
     * @return
     */
    @RequestMapping(name = "获取报告总数", value = "/v1/reports/number", method = RequestMethod.GET)
    ResponseEntity<Integer> countCheckReport();

    /**
     * 通过时间类型统计  1 周  2 月  3 年
     *
     * @param type
     * @return
     */
    @RequestMapping(name = "按时间统计测评报告", value = "/v1/reports/statistics/{type}", method = RequestMethod.POST)
    ResponseEntity<List<CheckItemReportStatisticsDetailVO>> countCheckReportByDateType(@PathVariable("type") @Validated @Number(enableNull = false, enableValues = {1, 2, 3}, message = "invalid type") Integer type);
    /**
     * 保存测评结果记录
     *
     * @param reportId
     * @param itemId
     * @param addCheckItemResultRequest
     * @return
     */
    @RequestMapping(name = "保存测评结果记录", value = "/v1/reports/{reportId}/items/{itemId}", method = RequestMethod.POST)
    ResponseEntity<AddChildCheckItemResultVO> addCheckItemResult(@PathVariable("reportId") Long reportId, @PathVariable("itemId") Long itemId, @RequestBody @Validated AddCheckItemResultRequest addCheckItemResultRequest);


    /**
     * 查询测评结果记录
     *
     * @param reportId
     * @param itemId
     * @return
     */
    @RequestMapping(name = "查询测评结果记录", value = "/v1/reports/{reportId}/items/results/{itemId}", method = RequestMethod.GET)
    ResponseEntity<ChildCheckItemResultDetailDTO > getCheckItemResult(@PathVariable("reportId") Long reportId, @PathVariable("itemId") Long itemId);


    /**
     * 生成测评报告
     *
     * @param reportId
     * @return
     */
    @RequestMapping(name = "生成测评报告", value = "/v1/reports/{reportId}", method = RequestMethod.POST)
    ResponseEntity<CheckItemReportVO> generateCheckItemReport( @PathVariable("reportId") Long reportId);


}
